home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / util / cli / UnixUtils.lha / UnixUtils / TREE_README < prev    next >
Encoding:
Text File  |  1992-04-13  |  3.7 KB  |  91 lines

  1. (This is the original README file for tree, FF306, by Tomas Rokicki)
  2.  
  3. Tree.  A very, very simple directory tree traversal program.  I wrote it for
  4. two reasons:
  5.  
  6.     - To be able to zoo directory trees
  7.     - To be able to zoo large directories without waiting forever
  8.     - To be able to find the large files on my disk
  9.     - To be able to selectively `backup' files (with zoo, copy or whatnot),
  10.         deleting a certain set of directories and file extensions.
  11.  
  12. So that's what I wanted it to do.  Now how it works.
  13.  
  14. First, it always lists the tree starting at the current directory, and not
  15. prefixed by anything.  Thus, if I'm in the TeX:foo directory, and there is
  16. one file in it called `bar', the program will list the single output line
  17.  
  18. bar
  19.  
  20. and that's it.  All files listed are listed by the pathname starting at the
  21. current directory, so if TeX:foo contained a directory bar with files baz1
  22. and baz2, and TeX:foo also contained fubar, then the output would be
  23.  
  24. bar/baz1
  25. bar/baz2
  26. fubar
  27.  
  28. The files are listed in the order they are encountered, not alphabetically.
  29.  
  30. Simple enough?  Okay, here are the options.  Each option is either an option
  31. keyword or a parameter.  At any given time, one option keyword is in effect,
  32. and all parameters are added.
  33.  
  34. The option keywords are:
  35.  
  36. -d:   Add to the list of directories to be ignored.  Any parameters following
  37.       this will be skipped in the treewalk.  All parameters to this (and other)
  38.       options are case sensitive (this is a bug since the Amiga file system
  39.       isn't case sensitive; fix it if you like.)
  40.  
  41. -x:   Add to the list of file extensions to be ignored.  A file extension is an
  42.       outdated concept, in which the last part of a file name, after the last
  43.       period, is considered an extension.  Thus, the extension of a.b.c is `c';
  44.       the file foo does not have an extension.
  45.  
  46. -f:   Use this (one) parameter as the output format.  The output format is just
  47.       a string, where all `%s' sequences are replaced by the file name, all
  48.       `%d' sequences are replaced by the file size, all %% sequences are
  49.       replaced with a single percent sign, and all other characters are taken
  50.       verbatim.  Useful if you want to build a command file that does something
  51.       to all of the files.
  52.  
  53. -h:   Print a short informational message.
  54.  
  55. Thus, to find the largest files on the disk, I simply use
  56.  
  57.    tree -f "%d %s" | sort
  58.  
  59. (The sort program is also supplied as a freebie; this one reads from stdin and
  60. writes to stdout, or will function as the AmigaDOS one, but it's faster than
  61. the AmigaDOS one, even though it's written in quick and dirty C.)
  62.  
  63. To make a full backup of my disk onto the Syquest, I simply
  64.  
  65.    cd dh0:
  66.    tree -d tex/pk arc autodocs f18 -x dvi log o | zoo aI dh20:backup.date
  67.  
  68. which doesn't backup the directories tex/pk, arc, autodocs, and f18 (since they
  69. are rather large and easily recreated from distribution floppies) and doesn't
  70. save any .dvi, .log, or .o files (since object files especially take up a fair
  71. proportion of the disk), and backups the entire mass with zoo onto another
  72. drive.
  73.  
  74. This procedure (with maybe a few more directories added) can backup my entire
  75. 90MB disk onto a single 25MB file, which I put on a Syquest.  It does take a
  76. while to run (perhaps an hour; never really timed it) but I let it work
  77. overnight.
  78.  
  79. I have restored from these, so it does work.
  80.  
  81. There is so many more things that can be done with `tree', but I haven't decided
  82. on a nice general way to express these things (ie, it should function as a `du'
  83. as well, and an option to `Execute()' rather than print each output line might
  84. be nice) but I'll add them as I need them.  (Hey, the Execute() option is just
  85. a couple of lines of code . . . if you want it, you've got source . . .)
  86.  
  87. Now, whenever I zoo, I just `tree | zoo aI' rather than `zoo'; it's so much
  88. faster!
  89.  
  90. Enjoy!
  91.